package task.manager;

import junit.framework.Assert;
import junit.framework.TestCase;

/**
 * Test class for TaskList class.
 * 
 * @author Harrison Saylor, Aaron Mead, Marc Huet, Greg Ruskin
 * @version 2
 */
public class TaskListTest extends TestCase {
	
	TaskList testList;
	Task tTask;
	Task tTask2;
	
	/**
	 * Setup method for test case.
	 */
	public void setUp(){
		testList = new TaskList();
		tTask = new Task("Test Task", 2, 2, 2013, 1, 1, "cat");
		tTask2 = new Task("Dat Task", 1, 1, 2013, 1, 1, "cat");
	} // End of setUp() method.
	
	/**
	 * Tests the addTask() method in the TaskList class.
	 */
	public void testAddTask(){
		Assert.assertTrue("TaskList is not empty after initilization",testList.size()==0);
		testList.add(tTask);
		Assert.assertTrue("New Task was not added to TaskList",testList.size()==1);
		testList.add(tTask2);
		Assert.assertTrue("New Task was not added to filled TaskList",testList.size()>1);
	} // End of testAddTask() method.
	
	/**
	 * Tests the catNameEquals() method in the TaskList class.
	 */
	public void testCatNameEquals(){
		testList.add(tTask);
		testList.add(tTask2);
		Assert.assertTrue("Task's category does not match active category",testList.catNameEquals(1, "cat"));
	} // End of testCatNameEquals() method.
	
	/**
	 * Tests the delete() method in the TaskList class.
	 */
	public void testDelete(){
		testList.add(tTask);
		testList.add(tTask2);
		Assert.assertTrue("", testList.catNameEquals(1,"cat"));
		testList.delete(tTask.getTitle());
		Assert.assertFalse("Task not removed",testList.contains(tTask));
	} // End of testDelete() method.
	
} // End of TaskListTest class.
